package com.shrcl.engineerprocess.domain.impl;

import com.shrcl.engineerprocess.domain.EngineerProject;
import com.shrcl.engineerprocess.domain.EngineerProjectPlan;
import com.shrcl.engineerprocess.domain.EngineerProjectPlanDAO;
import com.shrcl.engineerprocess.domain.impl.EngineerProjectPlanImpl;
import edu.fudan.mylang.pf.BaseDAOService;
import edu.fudan.mylang.pf.IGenericQuery;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.stereotype.Service;

@Service("com.shrcl.engineerprocess.domain.EngineerProjectPlanDAO")
public class EngineerProjectPlanDAOImpl extends BaseDAOService<EngineerProjectPlan> implements EngineerProjectPlanDAO {
  public EngineerProjectPlan create(final Procedure1<? super EngineerProjectPlan> init) {EngineerProjectPlan engineerProjectPlan=EngineerProjectPlanImpl.create(getObjectFactory());
    final Procedure1<EngineerProjectPlan> _function = new Procedure1<EngineerProjectPlan>() {
        public void apply(final EngineerProjectPlan it) {
          init.apply(it);
        }
      };
    EngineerProjectPlan _doubleArrow = ObjectExtensions.<EngineerProjectPlan>operator_doubleArrow(engineerProjectPlan, _function);
    return _doubleArrow;
  }
  
  public Collection<EngineerProjectPlan> findPlanByProject(final EngineerProject eProject) {
    IGenericQuery<EngineerProjectPlan> query=getObjectFactory().createGenericQuery(EngineerProjectPlan.class,"select e from com.shrcl.engineerprocess.domain.impl.EngineerProjectPlanImpl as e   where ((e.engineerProject) = (:eProject)) and  e.active = 1      ").setParameter("eProject",eProject);
    Collection<EngineerProjectPlan> _list = query.list();
    return _list;
  }
}
